#include<iostream>
#include<string>
#include<vector>
using namespace std;

int FrontStar(string& str)
{
	int i, j, count = 0;
	int length = str.length();

	for (i = j = length - 1; i >= 0; i--)
	{
		if (str[i] != '*')
		{
			char tmp = str[j];
			str[j] = str[i];
			str[i] = tmp;
			j--;
		}
		else
			count++;
	}

	cout << str << endl;

	return count;
}

int main()
{
	unsigned short num;
	cout << "请输入需要移动的字符串个数：";
	cin >> num;

	vector<string> strs;
	cout << "请输入字符串：" << endl;
	while (num--)
	{
		string str;
		cin >> str;		// ab**cd**e*12
		strs.push_back(str);
	}

	cout << endl << "下面开始输出移动后结果" << endl;
	for (auto str : strs)
	{
		cout << FrontStar(str) << endl << endl;
	}

	return 0;
}